<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">

    <title> 接口详情</title>

    <meta name="keywords" content="">
    <meta name="description" content="">

    <!--[if lt IE 9]>
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->

    <link rel="shortcut icon" href="favicon.ico"> <link href="${pageContext.request.contextPath}/res/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/res/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/res/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/res/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
<div id="wrapper">
    <!--左侧导航开始-->
    <c:import url="menu.jsp"></c:import>
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row border-bottom">
            <c:import url="navTop.jsp"></c:import>
        </div>
        <div class="row J_mainContent" id="content-main">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>账户设置</h5>
                    </div>
                    <div class="ibox-content">

                        <table class="footable table " >
                            <thead>
                            </thead>
                            <tbody>
                            <tr>
                                <td>API接口</td>
                                <input type="hidden" name="" id="userAppkey" value="${user.appkey}" >
                                <c:if test="${user.appkey==null||user.appkey==''}">
                                    <td id="appkeyValue">API-key：未获取</td>
                                    <td>未获取</td>
                                    <td><a onclick="getKey()">获取</a></td>
                                </c:if>
                                <c:if test="${user.appkey!=null&&user.appkey!=''}">
                                    <td>API-key：${user.appkey}</td>
                                    <td>已获取</td>
                                    <td>-</td>
                                </c:if>

                            </tr>
                            <tr>
                                <td>登录密码</td>
                                <td>保障账户安全，建议密码由6-16位数字、字母、下划线中的2种组成</td>
                                <td>已设置</td>
                                <td><a>更换</a></td>
                            </tr>
                            <tr>
                                <td>绑定手机</td>
                                <td>您绑定的手机号码：${user.phone}</td>
                                <td>已绑定</td>
                                <td> <a>更换</a></td>
                            </tr>

                            </tbody>
                            <tfoot>
                            <tr>
                                <td colspan="5">
                                    <ul class="pagination pull-right"></ul>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--右侧部分结束-->
</div>

<!-- 全局js -->
<script src="${pageContext.request.contextPath}/res/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/res/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/res/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="${pageContext.request.contextPath}/res/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="${pageContext.request.contextPath}/res/js/plugins/layer/layer.min.js"></script>

<!-- 自定义js -->
<script src="${pageContext.request.contextPath}/res/js/hAdmin.js?v=4.1.0"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/index.js"></script>

<!-- 第三方插件 -->
<script src="${pageContext.request.contextPath}/res/js/plugins/pace/pace.min.js"></script>
<div style="text-align:center;">
    <p>来源:<a href="http://www.mycodes.net/" target="_blank">源码之家</a></p>
</div>
</body>

</html>
<script>

    function getKey() {
        var appkey = $("#userAppkey").val();
        if(appkey==""){
            $.ajax({
                type: "post",
                url: "${pageContext.request.contextPath}/getkey.do",
                dataType: "json",
                success:function(data) {
                    console.log(data);
                    if(data.status==1){
                        alert(data.msg);
                        location.reload();

                    }else{
                        alert(data.msg);
                    }
                }
            });
        }


    }
</script>